package com.app.services;

import com.app.module.email.ModEmail;
import com.app.repository.REmail;
import com.app.runtime.Runtime;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.json.JSONException;

/**
 * Created by Hendra on 1/4/2015.
 */
public class MailSrv implements Runtime {

//    private REmail email = new REmail();
    ModEmail modEmail;

    @Override
    public void service() {
        modEmail = new ModEmail();
        retrieveEmail();
//        checkOutbox();
    }

    private void retrieveEmail() {
        modEmail.readEmails(modEmail.connection());

    }

    private void checkOutbox() {
        try {
            modEmail.checkOutbox();
        } catch (JSONException ex) {
            Logger.getLogger(MailSrv.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
